local BaseData = require("data.base.BaseData")
local MagicKeyUnitData = class("MagicKeyUnitData", BaseData)

local schema = {}
schema["id"] = {"number", 0}
schema["level"] = {"number", 1}
schema["base_id"] = {"number", 0}
schema["heroId"] = {"number", 0} -- 装备于
schema["config"] = {"table", {}}
MagicKeyUnitData.schema = schema

function MagicKeyUnitData:ctor()
    MagicKeyUnitData.super.ctor(self)
end

function MagicKeyUnitData:getType()
    return require("utils.TypeHelper").TYPE_MAGICKEY
end

function MagicKeyUnitData:getPureParam()
    local param = {}
    param.id = self:getId()
    param.level = self:getLevel()
    param.base_id = self:getBase_id()
    param.heroId = self:getHeroId()
    return param
end

function MagicKeyUnitData:update(data)
    self:setProperties(data)
    local config = require("config.magickey").get(self:getBase_id())
    assert(config, "can not found cfg in magickey by id=" .. self:getBase_id())
    self:setConfig(config)
end

return MagicKeyUnitData
